<?php
/*Biverr V1.4 file */


session_start();
			$gigs_id=$_REQUEST['id'];

			include_once('config/db_conn.php');
			include_once('db_config/db_catagory.php');
			include_once('db_config/db_user.php');
			include_once('db_config/db_gigs.php');
			include_once('db_config/db_multiple_gigs.php');


			$gigs_obj=new gigs();
			$catagory=new catagory();
			$rs=$catagory->catagory_list();
			$user=new user();
			$rs_user=$user->user_list();
			$multiple_gigs =new multipleGigs();
			$rs_multiple_gigs=$multiple_gigs->multiple_gigs_list();

			$rs_gigs=$gigs_obj->uniq_gigs_list('id',$gigs_id);
			$data_gigs=mysql_fetch_array($rs_gigs);

			$i=0;
?>
<?php
if(@$_REQUEST['gigs_title']!='')
{
	$gigs_title= $_REQUEST['gigs_title'];
}
if(@$_REQUEST['submit'])
{
	$gigs=array();
	$gigs['gigs_title']=$_REQUEST['gigs_title'];
	$gigs['catagory_id']=$_REQUEST['catagory_id'];
    $gigs['multiple_gigs_id']=$_REQUEST['multiple_gigs_id'];
	$gigs['user_id']=$_SESSION['user_id'];
	$gigs['gigs_description']= htmlentities($_REQUEST['gigs_description'],ENT_QUOTES);
	$gigs['gigs_keywords_tags']=$_REQUEST['gigs_keywords_tags'];
	$gigs['gigs_maxi_days_to_comp']=$_REQUEST['gigs_maxi_days_to_comp'];
	if($_FILES['gigs_image']['name']!='')
	{
		$gigs['gigs_image']=date("ymdhi").$_FILES['gigs_image']['name'];
	}
	$fldArray=array();
	$fldArray['id']=$gigs_id;

	$rs_gigs_edit=$gigs_obj->dataUpdate('ninerr_gigs',$gigs,$fldArray);

	//reDirect('edit_gigs.php?title='.str_replace(' ','-', $gigs_title).'');
	$fileName=$_FILES['gigs_image']['name'];
	if($fileName!='')
	{
		$fileSize='2000';
		$fileTempName=$_FILES['gigs_image']['tmp_name'];
		$folderPath='gigsimg';
		$oldfileName='';
		fileUpload($fileName,$oldfileName,$fileSize,$fileTempName,$folderPath,$maxSize=5242880);
	}
	reDirect('edit_gigs.php?id='.$gigs_id);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $data_websetting['change_title']; ?></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<script type="text/javascript" src="javascript/jquery.simplemodal.js"></script>
<script type="text/javascript" src="javascript/init.js"></script>
<script type="text/javascript" src="javascript/init1.js"></script>

<script type="text/javascript">

/*var msg_box ="You dont have permission to copy";
function dis_rightclickIE(){
	if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
		alert(msg_box)
}

function dis_rightclickNS(e){
	if ((document.layers||document.getElementById&&!document.all) && (e.which==2||e.which==3))
	{
	alert(msg_box)
	return false;
	}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=dis_rightclickNS;
}
else if (document.all&&!document.getElementById){
document.onmousedown=dis_rightclickIE;
}
document.oncontextmenu=new Function("alert(msg_box);return false")*/
</script>
<!-- Script by hscripts.com -->

</head>
<body  ondragstart="return false" onselectstart="return false">
<div id="container" class="content">

<!--HEADER AREA-->
<?php include('header.php')?>
<!--HEADER AREA END-->
<div id="main" class="clearfix">
	<div class="main-tl">
	  	<div class="main-tr"></div>
	  	<div class="main-top"></div>
	</div>
	<div class="main-inner clearfix">
		<div class="side1">
		<!-- side1 content BEGIN ======================================================= -->
			<div class="gigs form js-responses">
				<form class="normal js-upload-form {is_required:&quot;true&quot;}" method="post" id="GigAddForm" enctype="multipart/form-data" action="">
					<h2>Edit Gig</h2>
<!-- general START============================= -->	
	<fieldset>
		<legend>General</legend>
		<div class="js-validation-part">
			<!-- I will -->
			<div class="input text required">
				<label>I Will</label>
				<input type="text" value="<?php  echo $data_gigs['gigs_title'];?>"  maxlength="255" name="gigs_title" id="gigs_title" />
				<p class="error"><?php echo @$err_msg_title; ?></p>
				<span class = 'character-info info'>
					You have <span id="js-gig-title-count"></span> characters left.					
				</span>
			</div>	
			<!-- gig cost -->
			<div class="input select required">
				<label>Gig Price</label>
				<select name="multiple_gigs_id" id="multiple_gigs_id">
					<option value="">Please select</option>
					<?php
				while($data_multiple_gigs=mysql_fetch_array($rs_multiple_gigs))
				{
				?>
                    <option value="<?php  echo $data_multiple_gigs['multiple_gigs_id'];?>"
					<?php if($data_gigs['multiple_gigs_id']==$data_multiple_gigs['multiple_gigs_id']){
						echo 'selected';
					}?> ><?php  echo $data_multiple_gigs['multiple_gigs_price'];?>
					</option>
					<?php
				}
				?>
				</select>
				<!--   TODO Expected duration can't be blank
    					Expected duration is not a number-->
				<span class="info"></span>
			</div>	
			<!-- Category -->
			<div class="input select required">
				<label>Category</label>
				<select name="catagory_id" id="catagory_id">
					<option value="">Please select</option>
					<?php
				while($data=mysql_fetch_array($rs))
				{
				?>
					<option value="<?php  echo $data['catagory_id'];?>" <?php
					if($data_gigs['catagory_id']==$data['catagory_id'])
					{
						echo 'selected';
					}
					 ?> ><?php  echo $data['catagory_name'];?></option>
					<?php
				}
				?>
				</select>
				<p class="error"><?php echo @$err_msg_catagory; ?></p>
				<span class="info">Choose a category that best matches your job to ensure successful review by our moderators</span>
			</div>	
			<!-- description -->			
			<div class="input textarea required">
				<label>Description</label>
				<textarea  name="gigs_description" id="profile_description" rows="6" cols="30" class="js-gig-description"><?php echo $data_gigs['gigs_description']; ?></textarea>
				<p class="error"><?php echo @$err_msg_description; ?></p>
				<span class="info">
					Be as descriptive as possible. 
					Provide samples, what is required, what you will and will not do. <br/> 
					Define the extents of this  job  - how many units, revisions, samples are included
				</span>
			</div>				
			<span class='info character-info'>You have <span id="js-gig-description-title-count"></span> characters left.</span>
			<!-- day to complete -->
			<div class="input text required">
				<label>Maximum Days To Complete</label>
				<input type="text" value="<?php echo $data_gigs['gigs_maxi_days_to_comp']; ?>" maxlength="5" name="gigs_maxi_days_to_comp" id="gigs_maxi_days_to_comp" />
				<p class="error"><?php echo @$err_msg_multiple_gigs; ?></p>
				<span class="info">The longest time it will take you to complete your work<br />
					Consider: time to accept the order, timezone differences, the free time you have for this work and correspondence with your buyers<br />
					Late deliveries are the  #1 reason for order cancellations</span>
			</div>
			<!-- Tags -->
			<div class="input text required">
				<label>Tags</label>
				<input type="text" value="<?php echo $data_gigs['gigs_keywords_tags']; ?>" name="gigs_keywords_tags" id="gigs_title" />
				<p class="error"><?php echo @$err_msg_keywords; ?></p>
				<span class="info">Enter keywords that best describe your  gigs . Comma separated tags.<br/>Example: "social, marketing, stickers, promotion"</span>
			</div>			
		</div>
	</fieldset>
<!-- general END ============================= -->
<!-- photo START============================= -->
	<fieldset>
		<legend>Photo</legend>
		<div class="input required">
			<label>Gig Image</label>
			<input type="file" value="" name="gigs_image" id="gig_Image" class="browsefile" size="30" />
			<span class='info'><br />
				 Do not use images already in use by other  jobs <br />
				 Image must be descriptive and relevant to your work<br />
				 Real work sample images sell many times more then others<br />

				 Never use other seller's images</span>
		</div>							
	</fieldset>
<!-- photo END============================= -->
					<div class="submit-block clearfix">
						<div class="submit"><input type="submit" name="submit" value="Edit" /></div>				
					</div>
				</form>
			</div>
		<!-- side1 content END ============================================================ -->
		</div><!-- end side1 -->
		<!-- side2 BEGIN ====================== -->
		<?php include('right.php'); ?>
		<!-- side2 END ====================== -->
	</div><!-- end main-inner-->
</div><!-- end main -->

<!--FOOTER AREA-->
<?php include('footer.php');?>
 <!--FOOTER AREA END-->

</div><!-- end container -->
</body>
</html>
